#include "StringList.h"

StringList::StringList()
{
	head = NULL;
}
StringList::StringList(String * headString)
{
	head = new List<String>(headString, NULL);
}
StringList::~StringList()
{
	printf("deleting String list\n");
	List<String> * search = head;
	int i = 0;
	while(search)
	{
		printf("String number %d\n",i);
		i++;
		search = search->Remove();
	}
	head = NULL;
	printf("done deleting strings\n");
}
void StringList::Add(String * payload)
{
	head = new List<String>(payload, head);
}
void StringList::Draw()
{
	List<String> * search = head;
	while(search)
	{
		if(search->payload)
			search->payload->Draw();
		search = search->next;
	}	
}
void StringList::AddGravity()
{
	List<String> * search = head;
	while(search)
	{
		if(search->payload)
			search->payload->AddGravitationalForce();
		search = search->next;
	}	
}
void StringList::Think(float elapsedTime)
{
	List<String> * search = head;
	while(search)
	{
		if(search->payload)
			search->payload->Think(elapsedTime);
		search = search->next;
	}	
}
void StringList::SetSpringConstant(float springConstant)
{
	List<String> * search = head;
	while(search)
	{
		if(search->payload)
			search->payload->SetSpringConstant(springConstant);
		search = search->next;
	}	
}

